<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/24 0024
 * Time: 13:48
 */

namespace app\index\model;
use think\Model;

class User extends Model
{
    public function login($data)
    {
        $user = User::getByUserName($data['user_name']);
        if ($user) {
            if($user['user_pwd'] == $data['user_pwd']){
                session('id',$user['id']);
                session('user_name',$user['user_name']);
                return 2;//登陆密码正确的情况
            }else{
                return 3;//登陆密码错误
            }
        }else{
            return 1;//用户不存在的情况
        }
    }
}